/**
 * Copyright (C), 2015-2019, XXX有限公司
 * FileName: MockQueue
 * Author:   pc
 * Date:     2019/9/5 14:31
 * Description: 模拟消息队列
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package com.example.rabbitmqdemo.testthread;

import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * 〈功能：〉<br> 
 * 〈模拟消息队列〉
 * @author liuhaoran
 * @create 2019/9/5 14:31
 * @since 1.0.0
 */
@Component
@Slf4j
public class MockQueue {
	//下单消息
	private String placeOrder;
	//订单完成消息
	private String completeOrder;

	public String getPlaceOrder() {
		return placeOrder;
	}
	@Async
	public void setPlaceOrder(String placeOrder) throws InterruptedException {
			log.info("接到下单请求"+placeOrder);
			//模拟处理
			try {
				Thread.sleep(1000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
			//给completeOrder赋值
			this.completeOrder = placeOrder;
			log.info("下单请求处理完毕"+placeOrder);
	}

	public String getCompleteOrder() {
		return completeOrder;
	}

	public void setCompleteOrder(String completeOrder) {
		this.completeOrder = completeOrder;
	}
}